= turbo_frame_tag "#{project.name}_#{package_name}_rpmlint" do
  - if lints_list.empty?
    No lints found.
  - else
    .accordion
      .accordion-item
        .accordion-button.collapsed.disabled-accordion
          .row.w-100
            .col-6.fw-bold
              Linter
            .col-2.fw-bold
              Severity
            .col-2.fw-bold
              Badness
            .col-2.d-none.d-md-block.fw-bold
              Errors (Unique)
      - lints_list.flatten.sort_by { |l| -l[:badness] }.group_by { |l| l[:linter] }.each do |lint, lint_list|
        - collapse_id = "collapse_#{lint}"
        - list_grouped_by_error_message = lint_list.group_by { |l| l[:error_message] }
        .accordion-item
          %h2.accordion-header
            %button.accordion-button.collapsed{ type: 'button',
                                                aria: { expanded: 'false', controls: collapse_id },
                                                data: { 'bs-toggle': 'collapse', 'bs-target': "##{collapse_id}" } }
              .row.w-100
                .col-6
                  = lint
                .col-2
                  - case lint_list.first[:level]
                  - when 'E'
                    .text-danger
                      Error
                  - when 'W'
                    .text-warning
                      Warning
                  - when 'I'
                    .text-info
                      Info
                .col-2
                  = lint_list.first[:badness]
                .col-2.d-none.d-md-block
                  = lint_list.count
                  = "(#{list_grouped_by_error_message.count})"
          .accordion-collapse.collapse{ id: collapse_id }
            .accordion-body
              - list_grouped_by_error_message.sort.each do |error_message, error_messages_list|
                .mt-3.mb-2
                  %small.font-monospace.text-muted
                    = error_message
                - error_messages_list.group_by { |l| l[:location] }.sort.each do |location, location_list|
                  %h6.ms-3
                    = location
                  - location_list.sort_by { |r| "#{r[:repo]}#{r[:arch]}#{r[:line]}" }.each do |repository|
                    .ms-5
                      = link_to(project_package_repository_architecture_rpmlint_path(project,
                                                                                     package_name,
                                                                                     repository[:repo],
                                                                                     repository[:arch],
                                                                                     anchor: "l#{repository[:line]}"),
                                target: '_top') do
                        #{repository[:repo]}.#{repository[:arch]}, line #{repository[:line]}
